package com.demos.video.view;

import android.util.Log;

import com.netease.neliveplayer.sdk.NELivePlayer;
import com.netease.neliveplayer.sdk.model.NEDynamicLoadingConfig;
import com.netease.neliveplayer.sdk.model.NESDKConfig;

import java.util.Map;

public class VideoView {
    private String TAG = VideoView.class.getSimpleName();

    public void load() {
        NESDKConfig config = new NESDKConfig();

        //如果需要应用层上报播放数据，那么设置dataUploadListener，默认SDK内部上报播放数据
//        config.dataUploadListener =  mOnDataUploadListener;
//
//        NELivePlayer.OnDataUploadListener mOnDataUploadListener = new NELivePlayer.OnDataUploadListener() {
//            @Override
//            public boolean onDataUpload(String url, String data) {
//                Log.d(TAG, "onDataUpload url:" + url + ", data:" + data);
//                return true;
//            }
//
//            @Override
//            public boolean onDocumentUpload(String url, Map<String, String> params, Map<String, String> filepaths) {
//                Log.d(TAG, "onDataUpload url:" + url + ", params:" + params+",filepaths:"+filepaths);
//                return  true;
//            }
//        };
//
//        //如果需要开启动态加载功能，那么设置dynamicLoadingConfig，默认关闭
//        config.dynamicLoadingConfig = new NEDynamicLoadingConfig();
//        config.dynamicLoadingConfig.isDynamicLoading = true;
//        //使用Armeabiv7a架构示例，使用其他架构可以参考修改
//        config.dynamicLoadingConfig.isArmeabiv7a = true;
//        config.dynamicLoadingConfig.armeabiv7aUrl = 客户服务器地址 + "LivePlayer_Android_SDK_" + PlayerManager.getSDKInfo(this).version + "_" + "armeabi-v7a" + ".zip";
//        //动态加载准备完成时回调
//        config.dynamicLoadingConfig.onDynamicLoadingListener = mOnDynamicLoadingListener;
//        private static NELivePlayer.OnDynamicLoadingListener mOnDynamicLoadingListener = new NELivePlayer.OnDynamicLoadingListener() {
//            @Override
//            public void onDynamicLoading(final NEDynamicLoadingConfig.ArchitectureType type, final boolean isCompleted) {
//                Handlers.sharedHandler(DemoCache.getContext()).post(new Runnable() {
//                    @Override
//                    public void run() {
//                        Toast.makeText(DemoCache.getContext(), "type:" + type + "isCompleted:" + isCompleted, Toast.LENGTH_SHORT).show();
//                    }
//                });
//                LogUtil.d(TAG, "type:" + type + "，isCompleted:" + isCompleted);
//            }
//        };

//        NELivePlayer.init(this,config);
    }
}
